UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VlC8TD8I4zUj1CVgiL5LAMQNJIFGeePr6OMuFfv2W3Y=' 
WHERE 
  key_id = '42d4267f1314cdf62307067bd7fc38dd98f47c6106c4f77bdaf4f6d9c2381087' 
  AND (
    token = 'VlC8TD8I4zUj1CVgiL5LAMQNJIFGeePr6OMuFfv2W3Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026