UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HV1cqi8XTwg8pGdOt0YpASo67Aif/7IuB9qa/EflkCE=' 
WHERE 
  key_id = '8f0791b1370f30e16526e4331f048c436822457d7ceb68d6b21233ac50c388ce' 
  AND (
    token = 'HV1cqi8XTwg8pGdOt0YpASo67Aif/7IuB9qa/EflkCE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055