UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'duh113/KUrhAwwLMT/6E0QsVb13oowAkTkdSSeABKyk=' 
WHERE 
  key_id = '197a7f91447e7f48a6fe08556c1c43135096872f88a7bb84df9af518fc7507f4' 
  AND (
    token = 'duh113/KUrhAwwLMT/6E0QsVb13oowAkTkdSSeABKyk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045