UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KwretkT6JOsFwaR9hmKL0cYmeytvLalMMdmvI+W0Hoc='
WHERE
key_id = 'ad7a12eb511ceff49f2e28d12578c921f46de0741308ff1db04e8743b418a8ec'
AND (
token = 'KwretkT6JOsFwaR9hmKL0cYmeytvLalMMdmvI+W0Hoc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)