UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cYp1qZjA2n1Ylbm9jccnXxaRpW/0qLVUABqI424TWQg=' 
WHERE 
  key_id = '9f8b68506a6b27d155524b6a78257d3141007e10caa7f6296e5691396e4d53be' 
  AND (
    token = 'cYp1qZjA2n1Ylbm9jccnXxaRpW/0qLVUABqI424TWQg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032