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