UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4qXmOr6z3wMiDwW4X4U0OEw8jpeI8HxoBxxUQlC311k='
WHERE
key_id = 'e84de07cadc8c95067e45d833c2804e7187acf1044d5bde995f494525a0daf56'
AND (
token = '4qXmOr6z3wMiDwW4X4U0OEw8jpeI8HxoBxxUQlC311k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)