UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6YJ2B4fqyZdiUD+tNO0Fiy0dX/QikGONRNGKmWqLDWM='
WHERE
key_id = 'c4b47f6791575a7865a48a91097a6a0755f1a5de04cb94037e7665b3f89fcf28'
AND (
token = '6YJ2B4fqyZdiUD+tNO0Fiy0dX/QikGONRNGKmWqLDWM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)