UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o5WOkMzPBAUb39vveKeoauyZYOuO6cg3ItuU30M7ke4='
WHERE
key_id = 'b64d4d342b7ff379a6224ba4b8715f795d4f55d433541dcdad49771e00b8dc3e'
AND (
token = 'o5WOkMzPBAUb39vveKeoauyZYOuO6cg3ItuU30M7ke4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)