UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eLhhfWwdPBs6HvYayyGPOMiln1ydTtIYBhaKsvhSSLM=' 
WHERE 
  key_id = 'c46922ffa81586f01ffec99c8265477b5167e04719dccff97cc7e27ba8b63647' 
  AND (
    token = 'eLhhfWwdPBs6HvYayyGPOMiln1ydTtIYBhaKsvhSSLM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041