UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Jn5ktHw82r8gz6dWkJ/YZ0cEephUuE80oxBj5l5zA2Q='
WHERE
key_id = 'd9808be13c52eb693b7bc8585e1ce1b740ccc39c71dee8df19eccf34bf7b3891'
AND (
token = 'Jn5ktHw82r8gz6dWkJ/YZ0cEephUuE80oxBj5l5zA2Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)