UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n09ChICHqnw7zRcSVEE5WxQF4ISrISBk7/quRLDwhoI=' 
WHERE 
  key_id = '111c3b741310d54c48de2b23a072168b2422ab3db6c44955a91b7c278c696c1f' 
  AND (
    token = 'n09ChICHqnw7zRcSVEE5WxQF4ISrISBk7/quRLDwhoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022