UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xQprrx9H9Hie9cay1irlbjUaNYl1UfbiQtyyKev8JkM=' 
WHERE 
  key_id = '596a6d5497bbae7896ba1a1c8ef51a217e5bbcc83aafbed1a69ffd86839f4ca3' 
  AND (
    token = 'xQprrx9H9Hie9cay1irlbjUaNYl1UfbiQtyyKev8JkM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035