UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ECbaYkexZzGymHuY1iPyVco5AliQAIhdJykhm/Vuki4=' 
WHERE 
  key_id = '97a6d3de84242004a4ff8105ecdcb37e500b1f56285192b2645729c1ee356d29' 
  AND (
    token = 'ECbaYkexZzGymHuY1iPyVco5AliQAIhdJykhm/Vuki4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036