UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XSJ0kUAd4BdLzuwSdbtgjUTnrvapFZ0AYM54E1vbH6o='
WHERE
key_id = '09ecfa8da61eedd25da98f96ed3806ee219bf5331478872e0b894f1977a6dba7'
AND (
token = 'XSJ0kUAd4BdLzuwSdbtgjUTnrvapFZ0AYM54E1vbH6o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)