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

Query time 0.00039