UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qXcinvzrVmRziLII+Ahgzhnb/p7y4PNN7OSfh+sRBRY='
WHERE
key_id = 'e966019ce2ad31ffbe3c96eda1c8606d1185c6089b82562f527b05123372d748'
AND (
token = 'qXcinvzrVmRziLII+Ahgzhnb/p7y4PNN7OSfh+sRBRY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)