UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cOBqnYtO2D+hodvaZfKHJusevxu0b67WzkmNUMoh9rQ=' 
WHERE 
  key_id = 'e3114b33412965816153d8819589147194cc291722298d375782669c184abf74' 
  AND (
    token = 'cOBqnYtO2D+hodvaZfKHJusevxu0b67WzkmNUMoh9rQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029