UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FnYRmjcNMh2TlpWvxmn8cc1RcmbyRYLDwZW5NcKW78A='
WHERE
key_id = 'a7e6d3597fda43c0489ba31c9de0fc92087484a18571e65fdc00b91d32e15a4c'
AND (
token = 'FnYRmjcNMh2TlpWvxmn8cc1RcmbyRYLDwZW5NcKW78A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)