UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3T7T8pUAhxSMEp5egVRxTUSQvUk+4AUxcdK1/EqIps0='
WHERE
key_id = 'fb21fcea7fb52be1961e9976fd661ded5ca8f0214789479f414bd67df56729d7'
AND (
token = '3T7T8pUAhxSMEp5egVRxTUSQvUk+4AUxcdK1/EqIps0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)