UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o3RS6qAcdRAMiQt+VckMOag6uBObCa+odCxwfDQSSk0=' 
WHERE 
  key_id = '135286b78599b35dbdc3a47050a7a158cb743ba80a1059e15b84ebaeda0d6111' 
  AND (
    token = 'o3RS6qAcdRAMiQt+VckMOag6uBObCa+odCxwfDQSSk0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048