UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BcHzXMswd8T1YUd9CPjEtJc+yNuf8p3Hkw8mr0js+3o='
WHERE
key_id = '35acc2a6c7431d0405b220bf8453d96696295e299c145c6f76392185604379fe'
AND (
token = 'BcHzXMswd8T1YUd9CPjEtJc+yNuf8p3Hkw8mr0js+3o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)