UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XaQJo7YHBJWNnUTnhLqmV6X2EFL5x0XN1hAuBRmF1f8='
WHERE
key_id = '6c139267a5a6b9325dc30b242e220b4c0237cf3a49f58b53cf4495530ba9ce68'
AND (
token = 'XaQJo7YHBJWNnUTnhLqmV6X2EFL5x0XN1hAuBRmF1f8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)