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