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