UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J7QYmnOo5vRwyyHla/Pc6B4FLiRFwCDx51y4GClE870=' 
WHERE 
  key_id = '3cf391e1acf5a81d5e35821528504860ccb69628e790b51369594eab53d6aa3d' 
  AND (
    token = 'J7QYmnOo5vRwyyHla/Pc6B4FLiRFwCDx51y4GClE870=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062