UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qSL3Y65IwWpwk2brvGeaXB5WBqTdAHWesSkPml6hCZA=' 
WHERE 
  key_id = '18433ba1b7cdf9fe00a683272cadd9c07087ced093a28d9fbaac98ddb4feae02' 
  AND (
    token = 'qSL3Y65IwWpwk2brvGeaXB5WBqTdAHWesSkPml6hCZA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043