UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CF2BtSuTBYwoiBJSZGfTiWPu9kPeXopLjwAfuqW3b+g=' 
WHERE 
  key_id = '2e1afa08abcc34b663d65af139d23840142bf6620b3c8d208d85e3563c7c637b' 
  AND (
    token = 'CF2BtSuTBYwoiBJSZGfTiWPu9kPeXopLjwAfuqW3b+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024