UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QAoikggfVD1MlNGYd9Lreir+Q2CF184UOhYg3oyZFHI=' 
WHERE 
  key_id = '2c865b7296cc2db4223e3a3493b7ea4c0a44ae3ba1e047be54d13cca07bc987a' 
  AND (
    token = 'QAoikggfVD1MlNGYd9Lreir+Q2CF184UOhYg3oyZFHI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039